package cn.yuanqiao.archive.archiveBorrow.mapper;

import cn.yuanqiao.archive.archiveBorrow.domain.YqDaBorrow;
import cn.yuanqiao.archive.archiveBorrow.domain.YqdaborrowItem;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * archiveBorrowMapper接口
 * 
 * @author yuanqiao
 * @date 2023-07-14
 */
public interface YqDaBorrowMapper
{
    /**
     * 查询archiveBorrow
     *
     * @param borrowId archiveBorrow主键
     * @return archiveBorrow
     */
    public YqDaBorrow selectYqDaBorrowByBorrowId(Long borrowId);

    /**
     * 查询archiveBorrow列表
     *
     * @param yqDaBorrow archiveBorrow
     * @return archiveBorrow集合
     */
    public List<YqDaBorrow> selectYqDaBorrowList(YqDaBorrow yqDaBorrow);
    public List<YqDaBorrow> selectYqDaBorrowList1(YqDaBorrow yqDaBorrow);

    /**
     * 新增archiveBorrow
     *
     * @param yqDaBorrow archiveBorrow
     * @return 结果
     */
    public int insertYqDaBorrow(YqDaBorrow yqDaBorrow);

    /**
     * 修改archiveBorrow
     *
     * @param yqDaBorrow archiveBorrow
     * @return 结果
     */
    public int updateYqDaBorrow(YqDaBorrow yqDaBorrow);

    /**
     * 满意度评价
     * @param yqDaBorrow
     * @return
     */
    public int updateYqDaBorrowMyd(YqDaBorrow yqDaBorrow);

    /**
     * 删除archiveBorrow
     *
     * @param borrowId archiveBorrow主键
     * @return 结果
     */
    public int deleteYqDaBorrowByBorrowId(Long borrowId);

    /**
     * 批量删除archiveBorrow
     *
     * @param borrowIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteYqDaBorrowByBorrowIds(Long[] borrowIds);

    /**
     * 批量删除archiveBorrowItem
     *
     * @param borrowIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteYqdaborrowItemByBorrowIds(Long[] borrowIds);

    /**
     * 批量新增archiveBorrowItem
     *
     * @param yqdaborrowItemList archiveBorrowItem列表
     * @return 结果
     */
    public int batchYqdaborrowItem(List<YqdaborrowItem> yqdaborrowItemList);


    /**
     * 通过archiveBorrow主键删除archiveBorrowItem信息
     *
     * @param borrowId archiveBorrowID
     * @return 结果
     */
    public int deleteYqdaborrowItemByBorrowId(Long borrowId);

    List<YqdaborrowItem> selectYqDaBorrowItemList(YqdaborrowItem yqdaborrowItem);


    Map<String, Object> selectArchiveByCategoryIdAndArchiveIdAndSubTableName(@Param("fieldCommon") String fieldCommon,@Param("archiveId") String archiveId,@Param("categoryId") Long categoryId,@Param("subTableName") String subTableName);

    List<Map<String, Object>> selectYqdaArchiveList(@Param("sql") String sql);

    int updateAllStatus(@Param("userId")Long userId);

    List<Map<String, Object>> executeSqlFunction(@Param("sql")String sql);

    int borrowItemMinusOne(@Param("itemId")String itemId);

    YqdaborrowItem selectYqDaBorrowItemById(@Param("itemId")String itemId);

    int borrowItemMinusOnePrint(@Param("itemId")String itemId);

    void updateArchiveSFJC(@Param("daId")String daId,@Param("tenantCode")String tenantCode,@Param("subTableName") String subTableName,@Param("state") String state);

    void updateArchiveSFJCNew(@Param("tableId")String tableId,@Param("tableName")String tableName,@Param("subTableName") String subTableName,@Param("state") String state,@Param("sql")String sql);

    public Map<String,Object> selectCategory(@Param("categoryTable") String categoryTable, @Param("categoryId")Long categoryId);

    int updateborrowitem(@Param("borrowId")Long borrowId);
}
